﻿<!--
Preview.xaml
Author: Daniel Sklenitzka

Copyright 2013 The CWC Team

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<UserControl x:Class="Genesis.UI.Preview"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:overlay="clr-namespace:Genesis.UI.Overlay"
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Style TargetType="ItemsControl">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <Canvas/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="ContentPresenter">
                        <Setter Property="Canvas.Left" Value="{Binding X}"/>
                        <Setter Property="Canvas.Top" Value="{Binding Y}"/>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    
        <Viewbox>
        <Grid>
            <Image Name="image" Source="{Binding Image}">
                <Image.LayoutTransform>
                    <ScaleTransform ScaleY="-1"/>
                </Image.LayoutTransform>
            </Image>
     
        <ItemsControl ItemsSource="{Binding StartingPositions}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border>
                        <overlay:Circle Margin="-10"/>
                        <Border.LayoutTransform>
                            <ScaleTransform ScaleX="{Binding Scale}" ScaleY="{Binding Scale}"/>
                        </Border.LayoutTransform>
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
        <ItemsControl ItemsSource="{Binding Resources}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Border>
                        <overlay:Star Margin="-5.5"/>
                        <Border.LayoutTransform>
                            <ScaleTransform ScaleX="{Binding Scale}" ScaleY="{Binding Scale}"/>
                        </Border.LayoutTransform>
                    </Border>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
    </Viewbox>

</UserControl>
